# !/bin/bash


dnf install -y net-tools vim epel-release
dnf install -y supervisor
timedatectl set-timezone 'Asia/Shanghai'
systemctl enable --now chronyd
systemctl restart chronyd
hwclock -w


nf_conntrack_max=$(free| grep Mem|awk '{print int($2*1024/16384/2)}')

# 设置内核参数
cat > /etc/sysctl.d/custom.conf << EOF
net.ipv4.tcp_tw_reuse=1 # 重用timw-wait连接

# 连接追踪配置
net.netfilter.nf_conntrack_tcp_timeout_established=30 # 只踪30秒
net.netfilter.nf_conntrack_max=${nf_conntrack_max}
EOF

cat >> /etc/systemd/system.conf << EOF
DefaultLimitNOFILE=1000000
DefaultLimitNPROC=100000
EOF